package com.testing.class4;

import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import java.security.Key;

/**
 * @Classnroy这是要复制粘贴的内容ion 类型说明
 * @Date 2023/10/17 21:22
 * @Created by 特斯汀Roy
 */
public class RobotTest {
    public static void main(String[] args) throws AWTException {
        Robot robot=new Robot();
        robot.mouseMove(966,242);
        robot.mousePress(KeyEvent.BUTTON1_DOWN_MASK);
        robot.mouseMove(949,219);
        robot.mouseRelease(KeyEvent.BUTTON1_DOWN_MASK);


        robot.keyPress(KeyEvent.VK_R);
        robot.keyRelease(KeyEvent.VK_R);
        robot.keyPress(KeyEvent.VK_O);
        robot.keyPress(KeyEvent.VK_Y);

        String content="这是要复制粘贴的内容";
        //创建剪贴板
//        Clipboard clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
//        //在剪贴板中设置自己要输入的内容
//        StringSelection clip=new StringSelection(content);
//        clipboard.setContents(clip,null);
//
//        robot.keyPress(KeyEvent.VK_CONTROL);
//        robot.keyPress(KeyEvent.VK_V);
//        robot.keyRelease(KeyEvent.VK_CONTROL);
//        robot.keyRelease(KeyEvent.VK_V);


    }
}
